package com.xxxy.quartz;

import com.xxxy.utils.SpringApplicationUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobKey;

/**
 * @author sjh
 * @date 2022/3/23 23:27
 */
public class EndQuartz implements Job {

    ExamQuartzService examQuartzService = SpringApplicationUtils.getBean(ExamQuartzService.class);

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        JobKey jobKey = jobExecutionContext.getJobDetail().getKey();
        Integer id =  Integer.parseInt(jobKey.getName().replace("end",""));
        examQuartzService.end(id);
    }
}

